import React, {PureComponent} from 'react'
import {Link, Outlet} from "react-router-dom";
import WithRouter from "../hoc/WithRouter";

export class Home extends PureComponent {

    navigateTo(path) {
        const { navigate } = this.props.router
        console.log(navigate)
        navigate(path)
    }

    render() {
        return (
            <div>
                <h2>Home</h2>
                <div>
                    <span>
                      <Link to="/home/recommend">推荐</Link>
                    </span>
                    <span>
                        <Link to="/home/ranking">排行榜 </Link>
                    </span>
                    <button onClick={() => this.navigateTo("/home/popular")}>流行</button>
                </div>
                <Outlet/>
            </div>
        )
    }
}

export default WithRouter(Home)